#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
     media=new QMediaPlayer(this);


}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{   QString name = QFileDialog::getOpenFileName(this,"选择音频");
    media->setMedia(QUrl::fromLocalFile(name));
    media->play();
}
